// pages/mine.ts
import createRouter from "../../router/routers"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    menuList: [{ text: '常用组件', img: '/pages/image/mine/order.png' },
    { text: '常用api', img: '/pages/image/mine/jiedu.png' },
    { text: "我的地址", img: '/pages/image/mine/location.png' },
    { text: '邀请好友', img: '/pages/image/mine/haoyou.png' },
    { text: '动画', img: '/pages/image/mine/ani.png' },
    { text: '用户设置', img: '/pages/image/mine/shezhi.png' },
    { text: 'skyline 渲染', img: '/pages/image/mine/shezhi.png' },],
    x: 0,		//悬浮图标横坐标
    y: 0,		//悬浮图标纵坐标
    navHeight: 100,  //标题高度
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {

  },
  onShow() {
    // 自定义tabbar
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 4
      })
    }
  },
  clickMenu(e: any) {
    let index = e.currentTarget.dataset.index
    switch (index) {
      case 0:
        createRouter().push('/mine/components')
        break;
      case 1:
        wx.navigateTo({
          url: "/mine/pages/wxApi/index"
        })
        break;
      case 2:
        wx.navigateTo({
          url: "./loc/index"
        })
        break;
      case 3:
        wx.navigateTo({
          url: "./inviteFriends/inviteFriends"
        })
        break;
      case 4:
        createRouter().push("/mine/ani")
        break;
      case 5:
        wx.navigateTo({
          url: "./setting/setting"
        })
        break;
      case 6:
        createRouter().push('/mine/skyline')
        break;
    }
  },
  points() {
    wx.showModal({
      content: '即将离开微信，打开“医检助手 医生端APP”',
      confirmText: '确定',
      cancelText: '取消',
      confirmColor: '#0091FF',
      cancelColor: '#999999',
      success(res) {
        if (res.confirm) {
          // siteService.loginOut(Store.getLocalSync('id')).then(res=>{
          // })
          // getApp().globalData.loginOut = true
          // createRouter().reLaunch('/login')
          // wx.clearStorage()
          // loginOutTIM()
        }
      }
    })
  },
  toLogin() {
    createRouter().push("/login")
  },
})